import { AxiosResponse } from 'axios';
import { AuthenticateAPIResult, UserAuthorizeInfo } from '../../types/User';
import { axiosInstance } from '../../utils/Axious';
import Company from '../../types/Company'

export const registerUser=(
    from:Company
):Promise<AxiosResponse<UserAuthorizeInfo>>=>{
    return axiosInstance.post('/company/register',{
        ...from,
    });
};

// authenticate接口
export const authenticateUser = (
    username: string,
    password: string
  ): Promise<AxiosResponse<AuthenticateAPIResult>> => {
    return axiosInstance.post('/authenticate', {
      username,
      password,
    });
  };
  
  // authorize接口
  export const authorizeUser = (
    token: string
  ): Promise<AxiosResponse<UserAuthorizeInfo>> => {
    return axiosInstance.post('/authorize', {
      token,
    });
  };
  
  // 用户登出
  export const userLogout = (): Promise<AxiosResponse<null>> => {
    return axiosInstance.get('/logout');
  };
  